package com.huatai.bpmn.service.impl;

import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.huatai.bpmn.constant.PMPConstant;
import com.huatai.common.util.ObjectUtil;
import org.springframework.stereotype.Service;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;

import com.huatai.bpmn.mapper.UrgeCheckMapper;
import com.huatai.bpmn.entity.UrgeCheckEntity;
import com.huatai.bpmn.service.UrgeCheckService;

import java.util.List;

/**
 * 用户催审记录表
 *
 * @author yxy
 * @email yuanxy999@126.com
 * @date 2024-07-25 10:34:36
 */
@Service("urgeCheckService")
public class UrgeCheckServiceImpl extends ServiceImpl<UrgeCheckMapper, UrgeCheckEntity> implements UrgeCheckService {

	/**
	 * 根据实列key和实列id查询数据
	 * @param taskName
	 * @param processId
	 * @return
	 */
	@Override
	public boolean getByMykeyAndProcessId(String taskName, String processId,int status) {
		UrgeCheckEntity urgeCheckEntity = this.getOne(Wrappers.<UrgeCheckEntity>lambdaQuery().eq(UrgeCheckEntity::getMyKey, taskName)
			.eq(UrgeCheckEntity::getProcessId, processId).eq(UrgeCheckEntity::getStatus,status));
		if (ObjectUtil.isEmpty(urgeCheckEntity)){
			return false;
		}
		return true;
	}

	/**
	 * 查询催办任务接收人所有任务
	 * @param realName
	 * @return
	 */
	@Override
	public List<UrgeCheckEntity> listByRecipient(String realName) {
		return this.list(Wrappers.<UrgeCheckEntity>lambdaQuery().like(UrgeCheckEntity::getRecipient,realName).eq(UrgeCheckEntity::getStatus, PMPConstant.STATUS_1));
	}
}
